const file = require('../services/file.js')
const {
    SuccessModel,
    ErrorModel
} = require('../model/ResModel')
const successInfo = require('../model/SucessInfo')
const ErrorInfo = require('../model/ErrorInfo')

async function travelFile(ctx) {
    let {path} = ctx.query
    path = path || ''
    const res = await file._travelFile(path)
    if (res) {
        ctx.body = new SuccessModel(successInfo.getSuccess, res)
    } else {
        ctx.body =  new ErrorModel(ErrorInfo.getFail)
    }
}

module.exports = {
    travelFile,
}
